<template>
	<sc-table-select
		multiple
		clearable
		v-model="value"
		:apiObj="apiObj"
		:props="props"
		:tableWidth="600"
		@change="change">
		<template #header="{ form, submit }">
			<el-form :inline="true" :model="form">
				<el-form-item>
					<el-select v-model="form.lineId" placeholder="选择产线查询" clearable :teleported="false">
						<el-option
							v-for="item in lineListOptions"
							:key="item.id"
							:label="item.lineName"
							:value="item.id" />
					</el-select>
				</el-form-item>
				<el-form-item>
					<el-button type="primary" @click="submit">查询</el-button>
				</el-form-item>
			</el-form>
		</template>

		<el-table-column prop="opCode" label="工位编号" width="140"></el-table-column>
		<el-table-column prop="opName" label="工位名称" width="220"></el-table-column>
		<el-table-column prop="lineCode" label="产线编号" width=""></el-table-column>
	</sc-table-select>
</template>

<script>
export default {
	emits: ['change'],
	data() {
		return {
			apiObj: this.$API.mdstation.byline,
			lineListOptions: [],
			value: [],
			props: {
				label: 'opCode',
				value: 'id',
				keyword: "keyword"
			}
		}
	},
	mounted() {
		this.init();
	},
	methods: {
		async init() {
			const resp = await this.$API.mdline.list.get();
			this.lineListOptions = resp.data;
		},
		change(row) {
			this.$emit("change", row);
		}
	},
}
</script>
